package com.itheima.googleplay9.holder;

import android.view.View;

import butterknife.ButterKnife;

/**
 * Created by lxj on 2016/5/24.
 */
public abstract class BaseHolder<T> {
    View holderView;

    public BaseHolder(){
        //1.初始化convertView
        //2.初始化控件
        holderView = initHolderView();
        //绑定View
        ButterKnife.bind(this,holderView);

        //3.设置tag
        holderView.setTag(this);
    }

    /**
     * 初始化holderView
     * @return
     */
    protected abstract View initHolderView();

    /**
     * 绑定数据
     * @param data
     */
    public abstract void bindData(T data);

    /**
     * 获取convertView
     * @return
     */
    public View getHolderView(){
        return holderView;
    }
}
